<?php
/**
 * Created by PhpStorm.
 * User: kb130
 * Date: 2017/9/19
 * Time: 17:41
 */

namespace soa\mp\cloudPrint;

use soa\client;

class waybillSource extends client
{
    /**
     * 服务地址
     * @var string
     */
    public $service_url = 'http://mp.kuaidihelp.com/';

    /**
     * 服务名称
     * @var string
     */
    protected $service_name = 'kuaidihelp_mp';

    /**
     * @var array 23
     */
    private $sendUriList = [
        'store'   => 'api/cloudPrint/waybillSource/store',
        'destroy' => 'api/cloudPrint/waybillSource/destroy',
        'get'     => 'api/cloudPrint/waybillSource/getByCriteria',
        'get_user'=> 'api/cloudPrint/waybillSource/getByCriteriaForUser'
    ];


    /**
     * 保存操作
     * @param $uid
     * @param $platform
     * @param $custom_name
     * @param string $custom_pwd
     * @param array $extraInfo
     * @return array
     */
    public function store($uid, $platform, $custom_name, $custom_pwd, $custom_type, $site_flg = '', $parent_id = 0, $shipper_type = '', $other_info = [])
    {
        return $this->post($this->sendUriList['store'], compact('uid', 'platform', 'custom_name', 'custom_pwd', 'custom_type', 'site_flg', 'parent_id', 'shipper_type', 'other_info'));
    }

    /**
     * 删除操作
     * @param $uid
     * @param $platform
     * @param $custom_name
     * @return array
     * uid,
     */
    public function destroy($uid, $platform, $custom_name, $custom_type)
    {
        return$this->post($this->sendUriList['destroy'], compact('uid', 'platform', 'custom_name', 'custom_type'));
    }

    /**
     * 根据id获取操作
     * 如果不传custom_name，则表示获取这个账户的所有大客户数据。
     * @param $id
     * @return array
     */
    public function getByCriteria($id)
    {
        return $this->post($this->sendUriList['get'], compact('id'));
    }

    /**
     * 根据用户信息查询
     * @param $uid
     * @param $platform
     * @param $custom_type
     * @param int $parent_id 如果parent_id = ''，则去掉该条件来查询
     * @param string $custom_name
     * @return array
     */
    public function getByCriteriaForUser($uid, $platform, $custom_type, $parent_id = 0, $custom_name = '')
    {
        return $this->post($this->sendUriList['get_user'], compact('uid', 'platform', 'custom_type', 'parent_id', 'custom_name'));
    }
}